// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate rpc;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// A Parallelstore instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Instance {
    /// Identifier. The resource name of the instance, in the format
    /// `projects/{project}/locations/{location}/instances/{instance_id}`.
    pub name: std::string::String,

    /// Optional. The description of the instance. 2048 characters or less.
    pub description: std::string::String,

    /// Output only. The instance state.
    pub state: crate::model::instance::State,

    /// Output only. The time when the instance was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time when the instance was updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. Cloud Labels are a flexible and lightweight mechanism for
    /// organizing cloud resources into groups that reflect a customer's
    /// organizational needs and deployment strategies. See
    /// <https://cloud.google.com/resource-manager/docs/labels-overview> for details.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. Immutable. The instance's storage capacity in Gibibytes (GiB).
    /// Allowed values are between 12000 and 100000, in multiples of 4000; e.g.,
    /// 12000, 16000, 20000, ...
    pub capacity_gib: i64,

    /// Output only. Deprecated: The version of DAOS software running in the
    /// instance.
    #[deprecated]
    pub daos_version: std::string::String,

    /// Output only. A list of IPv4 addresses used for client side configuration.
    pub access_points: std::vec::Vec<std::string::String>,

    /// Optional. Immutable. The name of the Compute Engine
    /// [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the
    /// instance is connected.
    pub network: std::string::String,

    /// Optional. Immutable. The ID of the IP address range being used by the
    /// instance's VPC network. See [Configure a VPC
    /// network](https://cloud.google.com/parallelstore/docs/vpc#create_and_configure_the_vpc).
    /// If no ID is provided, all ranges are considered.
    pub reserved_ip_range: std::string::String,

    /// Output only. Immutable. The ID of the IP address range being used by the
    /// instance's VPC network. This field is populated by the service and contains
    /// the value currently used by the service.
    pub effective_reserved_ip_range: std::string::String,

    /// Optional. Immutable. Stripe level for files. Allowed values are:
    ///
    /// * `FILE_STRIPE_LEVEL_MIN`: offers the best performance for small size
    ///   files.
    /// * `FILE_STRIPE_LEVEL_BALANCED`: balances performance for workloads
    ///   involving a mix of small and large files.
    /// * `FILE_STRIPE_LEVEL_MAX`: higher throughput performance for larger files.
    pub file_stripe_level: crate::model::FileStripeLevel,

    /// Optional. Immutable. Stripe level for directories. Allowed values are:
    ///
    /// * `DIRECTORY_STRIPE_LEVEL_MIN`: recommended when directories contain a
    ///   small number of files.
    /// * `DIRECTORY_STRIPE_LEVEL_BALANCED`: balances performance for workloads
    ///   involving a mix of small and large directories.
    /// * `DIRECTORY_STRIPE_LEVEL_MAX`: recommended for directories with a large
    ///   number of files.
    pub directory_stripe_level: crate::model::DirectoryStripeLevel,

    /// Optional. Immutable. The deployment type of the instance. Allowed values
    /// are:
    ///
    /// * `SCRATCH`: the instance is a scratch instance.
    /// * `PERSISTENT`: the instance is a persistent instance.
    pub deployment_type: crate::model::DeploymentType,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Instance {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Instance::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Instance::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Instance::state].
    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Instance::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Instance::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [labels][crate::model::Instance::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [capacity_gib][crate::model::Instance::capacity_gib].
    pub fn set_capacity_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.capacity_gib = v.into();
        self
    }

    /// Sets the value of [daos_version][crate::model::Instance::daos_version].
    #[deprecated]
    pub fn set_daos_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.daos_version = v.into();
        self
    }

    /// Sets the value of [access_points][crate::model::Instance::access_points].
    pub fn set_access_points<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.access_points = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [network][crate::model::Instance::network].
    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.network = v.into();
        self
    }

    /// Sets the value of [reserved_ip_range][crate::model::Instance::reserved_ip_range].
    pub fn set_reserved_ip_range<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.reserved_ip_range = v.into();
        self
    }

    /// Sets the value of [effective_reserved_ip_range][crate::model::Instance::effective_reserved_ip_range].
    pub fn set_effective_reserved_ip_range<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.effective_reserved_ip_range = v.into();
        self
    }

    /// Sets the value of [file_stripe_level][crate::model::Instance::file_stripe_level].
    pub fn set_file_stripe_level<T: std::convert::Into<crate::model::FileStripeLevel>>(
        mut self,
        v: T,
    ) -> Self {
        self.file_stripe_level = v.into();
        self
    }

    /// Sets the value of [directory_stripe_level][crate::model::Instance::directory_stripe_level].
    pub fn set_directory_stripe_level<T: std::convert::Into<crate::model::DirectoryStripeLevel>>(
        mut self,
        v: T,
    ) -> Self {
        self.directory_stripe_level = v.into();
        self
    }

    /// Sets the value of [deployment_type][crate::model::Instance::deployment_type].
    pub fn set_deployment_type<T: std::convert::Into<crate::model::DeploymentType>>(
        mut self,
        v: T,
    ) -> Self {
        self.deployment_type = v.into();
        self
    }
}

impl wkt::message::Message for Instance {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.Instance"
    }
}

/// Defines additional types related to [Instance].
pub mod instance {
    #[allow(unused_imports)]
    use super::*;

    /// The possible states of a Parallelstore instance.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Not set.
        Unspecified,
        /// The instance is being created.
        Creating,
        /// The instance is available for use.
        Active,
        /// The instance is being deleted.
        Deleting,
        /// The instance is not usable.
        Failed,
        /// The instance is being upgraded.
        Upgrading,
        /// The instance is being repaired. This should only be used by instances
        /// using the `PERSISTENT` deployment type.
        Repairing,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Creating => std::option::Option::Some(1),
                Self::Active => std::option::Option::Some(2),
                Self::Deleting => std::option::Option::Some(3),
                Self::Failed => std::option::Option::Some(4),
                Self::Upgrading => std::option::Option::Some(5),
                Self::Repairing => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Failed => std::option::Option::Some("FAILED"),
                Self::Upgrading => std::option::Option::Some("UPGRADING"),
                Self::Repairing => std::option::Option::Some("REPAIRING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Creating,
                2 => Self::Active,
                3 => Self::Deleting,
                4 => Self::Failed,
                5 => Self::Upgrading,
                6 => Self::Repairing,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "CREATING" => Self::Creating,
                "ACTIVE" => Self::Active,
                "DELETING" => Self::Deleting,
                "FAILED" => Self::Failed,
                "UPGRADING" => Self::Upgrading,
                "REPAIRING" => Self::Repairing,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Creating => serializer.serialize_i32(1),
                Self::Active => serializer.serialize_i32(2),
                Self::Deleting => serializer.serialize_i32(3),
                Self::Failed => serializer.serialize_i32(4),
                Self::Upgrading => serializer.serialize_i32(5),
                Self::Repairing => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.parallelstore.v1.Instance.State",
            ))
        }
    }
}

/// Transfer metadata options for the instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransferMetadataOptions {
    /// Optional. The UID preservation behavior.
    pub uid: crate::model::transfer_metadata_options::Uid,

    /// Optional. The GID preservation behavior.
    pub gid: crate::model::transfer_metadata_options::Gid,

    /// Optional. The mode preservation behavior.
    pub mode: crate::model::transfer_metadata_options::Mode,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TransferMetadataOptions {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [uid][crate::model::TransferMetadataOptions::uid].
    pub fn set_uid<T: std::convert::Into<crate::model::transfer_metadata_options::Uid>>(
        mut self,
        v: T,
    ) -> Self {
        self.uid = v.into();
        self
    }

    /// Sets the value of [gid][crate::model::TransferMetadataOptions::gid].
    pub fn set_gid<T: std::convert::Into<crate::model::transfer_metadata_options::Gid>>(
        mut self,
        v: T,
    ) -> Self {
        self.gid = v.into();
        self
    }

    /// Sets the value of [mode][crate::model::TransferMetadataOptions::mode].
    pub fn set_mode<T: std::convert::Into<crate::model::transfer_metadata_options::Mode>>(
        mut self,
        v: T,
    ) -> Self {
        self.mode = v.into();
        self
    }
}

impl wkt::message::Message for TransferMetadataOptions {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.TransferMetadataOptions"
    }
}

/// Defines additional types related to [TransferMetadataOptions].
pub mod transfer_metadata_options {
    #[allow(unused_imports)]
    use super::*;

    /// The UID preservation behavior.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Uid {
        /// default is UID_NUMBER_PRESERVE.
        Unspecified,
        /// Do not preserve UID during a transfer job.
        Skip,
        /// Preserve UID that is in number format during a transfer job.
        NumberPreserve,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Uid::value] or
        /// [Uid::name].
        UnknownValue(uid::UnknownValue),
    }

    #[doc(hidden)]
    pub mod uid {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Uid {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Skip => std::option::Option::Some(1),
                Self::NumberPreserve => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("UID_UNSPECIFIED"),
                Self::Skip => std::option::Option::Some("UID_SKIP"),
                Self::NumberPreserve => std::option::Option::Some("UID_NUMBER_PRESERVE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Uid {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Uid {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Uid {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Skip,
                2 => Self::NumberPreserve,
                _ => Self::UnknownValue(uid::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Uid {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "UID_UNSPECIFIED" => Self::Unspecified,
                "UID_SKIP" => Self::Skip,
                "UID_NUMBER_PRESERVE" => Self::NumberPreserve,
                _ => Self::UnknownValue(uid::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Uid {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Skip => serializer.serialize_i32(1),
                Self::NumberPreserve => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Uid {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Uid>::new(
                ".google.cloud.parallelstore.v1.TransferMetadataOptions.Uid",
            ))
        }
    }

    /// The GID preservation behavior.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Gid {
        /// default is GID_NUMBER_PRESERVE.
        Unspecified,
        /// Do not preserve GID during a transfer job.
        Skip,
        /// Preserve GID that is in number format during a transfer job.
        NumberPreserve,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Gid::value] or
        /// [Gid::name].
        UnknownValue(gid::UnknownValue),
    }

    #[doc(hidden)]
    pub mod gid {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Gid {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Skip => std::option::Option::Some(1),
                Self::NumberPreserve => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("GID_UNSPECIFIED"),
                Self::Skip => std::option::Option::Some("GID_SKIP"),
                Self::NumberPreserve => std::option::Option::Some("GID_NUMBER_PRESERVE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Gid {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Gid {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Gid {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Skip,
                2 => Self::NumberPreserve,
                _ => Self::UnknownValue(gid::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Gid {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "GID_UNSPECIFIED" => Self::Unspecified,
                "GID_SKIP" => Self::Skip,
                "GID_NUMBER_PRESERVE" => Self::NumberPreserve,
                _ => Self::UnknownValue(gid::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Gid {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Skip => serializer.serialize_i32(1),
                Self::NumberPreserve => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Gid {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Gid>::new(
                ".google.cloud.parallelstore.v1.TransferMetadataOptions.Gid",
            ))
        }
    }

    /// The mode preservation behavior.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Mode {
        /// default is MODE_PRESERVE.
        Unspecified,
        /// Do not preserve mode during a transfer job.
        Skip,
        /// Preserve mode during a transfer job.
        Preserve,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Mode::value] or
        /// [Mode::name].
        UnknownValue(mode::UnknownValue),
    }

    #[doc(hidden)]
    pub mod mode {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Mode {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Skip => std::option::Option::Some(1),
                Self::Preserve => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
                Self::Skip => std::option::Option::Some("MODE_SKIP"),
                Self::Preserve => std::option::Option::Some("MODE_PRESERVE"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Mode {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Mode {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Mode {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Skip,
                2 => Self::Preserve,
                _ => Self::UnknownValue(mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Mode {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "MODE_UNSPECIFIED" => Self::Unspecified,
                "MODE_SKIP" => Self::Skip,
                "MODE_PRESERVE" => Self::Preserve,
                _ => Self::UnknownValue(mode::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Mode {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Skip => serializer.serialize_i32(1),
                Self::Preserve => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Mode {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
                ".google.cloud.parallelstore.v1.TransferMetadataOptions.Mode",
            ))
        }
    }
}

/// List instances request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesRequest {
    /// Required. The project and location for which to retrieve instance
    /// information, in the format `projects/{project_id}/locations/{location}`.
    ///
    /// To retrieve instance information for all locations, use "-" as the value of
    /// `{location}`.
    pub parent: std::string::String,

    /// Optional. Requested page size. Server may return fewer items than
    /// requested. If unspecified, the server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Hint for how to order the results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListInstancesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListInstancesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.ListInstancesRequest"
    }
}

/// Response from
/// [ListInstances][google.cloud.parallelstore.v1.Parallelstore.ListInstances].
///
/// [google.cloud.parallelstore.v1.Parallelstore.ListInstances]: crate::client::Parallelstore::list_instances
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesResponse {
    /// The list of Parallelstore instances.
    pub instances: std::vec::Vec<crate::model::Instance>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListInstancesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
    pub fn set_instances<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Instance>,
    {
        use std::iter::Iterator;
        self.instances = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListInstancesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.ListInstancesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
    type PageItem = crate::model::Instance;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.instances
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Get an instance's details.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetInstanceRequest {
    /// Required. The instance resource name, in the format
    /// `projects/{project_id}/locations/{location}/instances/{instance_id}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.GetInstanceRequest"
    }
}

/// Create a new Parallelstore instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateInstanceRequest {
    /// Required. The instance's project and location, in the format
    /// `projects/{project}/locations/{location}`.
    /// Locations map to Google Cloud zones; for example, `us-west1-b`.
    pub parent: std::string::String,

    /// Required. The name of the Parallelstore instance.
    ///
    /// * Must contain only lowercase letters, numbers, and hyphens.
    /// * Must start with a letter.
    /// * Must be between 1-63 characters.
    /// * Must end with a number or a letter.
    /// * Must be unique within the customer project / location
    pub instance_id: std::string::String,

    /// Required. The instance to create.
    pub instance: std::option::Option<crate::model::Instance>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.instance_id = v.into();
        self
    }

    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
    pub fn set_instance<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateInstanceRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.CreateInstanceRequest"
    }
}

/// Update an instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateInstanceRequest {
    /// Required. Mask of fields to update. Field mask is used to specify the
    /// fields to be overwritten in the Instance resource by the update. At least
    /// one path must be supplied in this field. The fields specified in the
    /// update_mask are relative to the resource, not the full request.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The instance to update.
    pub instance: std::option::Option<crate::model::Instance>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
    pub fn set_instance<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateInstanceRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.UpdateInstanceRequest"
    }
}

/// Delete an instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteInstanceRequest {
    /// Required. Name of the resource
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteInstanceRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.DeleteInstanceRequest"
    }
}

/// Long-running operation metadata.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have been cancelled successfully
    /// have [Operation.error][google.longrunning.Operation.error] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.OperationMetadata"
    }
}

/// Cloud Storage as the source of a data transfer.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SourceGcsBucket {
    /// Required. URI to a Cloud Storage bucket in the format:
    /// `gs://<bucket_name>/<path_inside_bucket>`. The path inside the bucket is
    /// optional.
    pub uri: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SourceGcsBucket {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [uri][crate::model::SourceGcsBucket::uri].
    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uri = v.into();
        self
    }
}

impl wkt::message::Message for SourceGcsBucket {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.SourceGcsBucket"
    }
}

/// Cloud Storage as the destination of a data transfer.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DestinationGcsBucket {
    /// Required. URI to a Cloud Storage bucket in the format:
    /// `gs://<bucket_name>/<path_inside_bucket>`. The path inside the bucket is
    /// optional.
    pub uri: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DestinationGcsBucket {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [uri][crate::model::DestinationGcsBucket::uri].
    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uri = v.into();
        self
    }
}

impl wkt::message::Message for DestinationGcsBucket {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.DestinationGcsBucket"
    }
}

/// Parallelstore as the source of a data transfer.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SourceParallelstore {
    /// Optional. Root directory path to the Paralellstore filesystem, starting
    /// with `/`. Defaults to `/` if unset.
    pub path: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SourceParallelstore {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [path][crate::model::SourceParallelstore::path].
    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.path = v.into();
        self
    }
}

impl wkt::message::Message for SourceParallelstore {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.SourceParallelstore"
    }
}

/// Parallelstore as the destination of a data transfer.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DestinationParallelstore {
    /// Optional. Root directory path to the Paralellstore filesystem, starting
    /// with `/`. Defaults to `/` if unset.
    pub path: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DestinationParallelstore {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [path][crate::model::DestinationParallelstore::path].
    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.path = v.into();
        self
    }
}

impl wkt::message::Message for DestinationParallelstore {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.DestinationParallelstore"
    }
}

/// Import data from Cloud Storage into a Parallelstore instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportDataRequest {
    /// Required. Name of the resource.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    /// Optional. User-specified service account credentials to be used when
    /// performing the transfer.
    ///
    /// Use one of the following formats:
    ///
    /// * `{EMAIL_ADDRESS_OR_UNIQUE_ID}`
    /// * `projects/{PROJECT_ID_OR_NUMBER}/serviceAccounts/{EMAIL_ADDRESS_OR_UNIQUE_ID}`
    /// * `projects/-/serviceAccounts/{EMAIL_ADDRESS_OR_UNIQUE_ID}`
    ///
    /// If unspecified, the Parallelstore service agent is used:
    /// `service-<PROJECT_NUMBER>@gcp-sa-parallelstore.iam.gserviceaccount.com`
    pub service_account: std::string::String,

    /// Optional. The transfer metadata options for the import data.
    pub metadata_options: std::option::Option<crate::model::TransferMetadataOptions>,

    /// The source of the data being imported into the Parallelstore instance.
    pub source: std::option::Option<crate::model::import_data_request::Source>,

    /// The Parallelstore instance into which to import data.
    pub destination: std::option::Option<crate::model::import_data_request::Destination>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ImportDataRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ImportDataRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::ImportDataRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [service_account][crate::model::ImportDataRequest::service_account].
    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_account = v.into();
        self
    }

    /// Sets the value of [metadata_options][crate::model::ImportDataRequest::metadata_options].
    pub fn set_metadata_options<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TransferMetadataOptions>,
    {
        self.metadata_options = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [metadata_options][crate::model::ImportDataRequest::metadata_options].
    pub fn set_or_clear_metadata_options<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TransferMetadataOptions>,
    {
        self.metadata_options = v.map(|x| x.into());
        self
    }

    /// Sets the value of [source][crate::model::ImportDataRequest::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::import_data_request::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::ImportDataRequest::source]
    /// if it holds a `SourceGcsBucket`, `None` if the field is not set or
    /// holds a different branch.
    pub fn source_gcs_bucket(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::SourceGcsBucket>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::import_data_request::Source::SourceGcsBucket(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::ImportDataRequest::source]
    /// to hold a `SourceGcsBucket`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_source_gcs_bucket<
        T: std::convert::Into<std::boxed::Box<crate::model::SourceGcsBucket>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::import_data_request::Source::SourceGcsBucket(v.into()),
        );
        self
    }

    /// Sets the value of [destination][crate::model::ImportDataRequest::destination].
    ///
    /// Note that all the setters affecting `destination` are mutually
    /// exclusive.
    pub fn set_destination<
        T: std::convert::Into<std::option::Option<crate::model::import_data_request::Destination>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = v.into();
        self
    }

    /// The value of [destination][crate::model::ImportDataRequest::destination]
    /// if it holds a `DestinationParallelstore`, `None` if the field is not set or
    /// holds a different branch.
    pub fn destination_parallelstore(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::DestinationParallelstore>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::import_data_request::Destination::DestinationParallelstore(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::ImportDataRequest::destination]
    /// to hold a `DestinationParallelstore`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_destination_parallelstore<
        T: std::convert::Into<std::boxed::Box<crate::model::DestinationParallelstore>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::import_data_request::Destination::DestinationParallelstore(v.into()),
        );
        self
    }
}

impl wkt::message::Message for ImportDataRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.ImportDataRequest"
    }
}

/// Defines additional types related to [ImportDataRequest].
pub mod import_data_request {
    #[allow(unused_imports)]
    use super::*;

    /// The source of the data being imported into the Parallelstore instance.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// The Cloud Storage source bucket and, optionally, path inside the bucket.
        SourceGcsBucket(std::boxed::Box<crate::model::SourceGcsBucket>),
    }

    /// The Parallelstore instance into which to import data.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Destination {
        /// Parallelstore destination.
        DestinationParallelstore(std::boxed::Box<crate::model::DestinationParallelstore>),
    }
}

/// Export data from Parallelstore to Cloud Storage.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportDataRequest {
    /// Required. Name of the resource.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and
    /// the request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    /// Optional. User-specified Service Account (SA) credentials to be used when
    /// performing the transfer.
    /// Use one of the following formats:
    ///
    /// * `{EMAIL_ADDRESS_OR_UNIQUE_ID}`
    /// * `projects/{PROJECT_ID_OR_NUMBER}/serviceAccounts/{EMAIL_ADDRESS_OR_UNIQUE_ID}`
    /// * `projects/-/serviceAccounts/{EMAIL_ADDRESS_OR_UNIQUE_ID}`
    ///
    /// If unspecified, the Parallelstore service agent is used:
    /// `service-<PROJECT_NUMBER>@gcp-sa-parallelstore.iam.gserviceaccount.com`
    pub service_account: std::string::String,

    /// Optional. The metadata options for the export data.
    pub metadata_options: std::option::Option<crate::model::TransferMetadataOptions>,

    /// The Parallelstore instance to export from.
    pub source: std::option::Option<crate::model::export_data_request::Source>,

    /// The Cloud Storage bucket to export to.
    pub destination: std::option::Option<crate::model::export_data_request::Destination>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportDataRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ExportDataRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::ExportDataRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [service_account][crate::model::ExportDataRequest::service_account].
    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_account = v.into();
        self
    }

    /// Sets the value of [metadata_options][crate::model::ExportDataRequest::metadata_options].
    pub fn set_metadata_options<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TransferMetadataOptions>,
    {
        self.metadata_options = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [metadata_options][crate::model::ExportDataRequest::metadata_options].
    pub fn set_or_clear_metadata_options<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TransferMetadataOptions>,
    {
        self.metadata_options = v.map(|x| x.into());
        self
    }

    /// Sets the value of [source][crate::model::ExportDataRequest::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::export_data_request::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::ExportDataRequest::source]
    /// if it holds a `SourceParallelstore`, `None` if the field is not set or
    /// holds a different branch.
    pub fn source_parallelstore(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::SourceParallelstore>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::export_data_request::Source::SourceParallelstore(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::ExportDataRequest::source]
    /// to hold a `SourceParallelstore`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_source_parallelstore<
        T: std::convert::Into<std::boxed::Box<crate::model::SourceParallelstore>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::export_data_request::Source::SourceParallelstore(v.into()),
        );
        self
    }

    /// Sets the value of [destination][crate::model::ExportDataRequest::destination].
    ///
    /// Note that all the setters affecting `destination` are mutually
    /// exclusive.
    pub fn set_destination<
        T: std::convert::Into<std::option::Option<crate::model::export_data_request::Destination>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = v.into();
        self
    }

    /// The value of [destination][crate::model::ExportDataRequest::destination]
    /// if it holds a `DestinationGcsBucket`, `None` if the field is not set or
    /// holds a different branch.
    pub fn destination_gcs_bucket(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::DestinationGcsBucket>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::export_data_request::Destination::DestinationGcsBucket(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::ExportDataRequest::destination]
    /// to hold a `DestinationGcsBucket`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_destination_gcs_bucket<
        T: std::convert::Into<std::boxed::Box<crate::model::DestinationGcsBucket>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::export_data_request::Destination::DestinationGcsBucket(v.into()),
        );
        self
    }
}

impl wkt::message::Message for ExportDataRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.ExportDataRequest"
    }
}

/// Defines additional types related to [ExportDataRequest].
pub mod export_data_request {
    #[allow(unused_imports)]
    use super::*;

    /// The Parallelstore instance to export from.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// Parallelstore source.
        SourceParallelstore(std::boxed::Box<crate::model::SourceParallelstore>),
    }

    /// The Cloud Storage bucket to export to.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Destination {
        /// Cloud Storage destination.
        DestinationGcsBucket(std::boxed::Box<crate::model::DestinationGcsBucket>),
    }
}

/// The response to a request to import data to Parallelstore.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportDataResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ImportDataResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for ImportDataResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.ImportDataResponse"
    }
}

/// An entry describing an error that has occurred.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransferErrorLogEntry {
    /// A URL that refers to the target (a data source, a data sink,
    /// or an object) with which the error is associated.
    pub uri: std::string::String,

    /// A list of messages that carry the error details.
    pub error_details: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TransferErrorLogEntry {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [uri][crate::model::TransferErrorLogEntry::uri].
    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uri = v.into();
        self
    }

    /// Sets the value of [error_details][crate::model::TransferErrorLogEntry::error_details].
    pub fn set_error_details<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.error_details = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for TransferErrorLogEntry {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.TransferErrorLogEntry"
    }
}

/// A summary of errors by error code, plus a count and sample error log
/// entries.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransferErrorSummary {
    /// One of the error codes that caused the transfer failure.
    pub error_code: rpc::model::Code,

    /// Count of this type of error.
    pub error_count: i64,

    /// A list of messages that carry the error details.
    pub error_log_entries: std::vec::Vec<crate::model::TransferErrorLogEntry>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TransferErrorSummary {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [error_code][crate::model::TransferErrorSummary::error_code].
    pub fn set_error_code<T: std::convert::Into<rpc::model::Code>>(mut self, v: T) -> Self {
        self.error_code = v.into();
        self
    }

    /// Sets the value of [error_count][crate::model::TransferErrorSummary::error_count].
    pub fn set_error_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.error_count = v.into();
        self
    }

    /// Sets the value of [error_log_entries][crate::model::TransferErrorSummary::error_log_entries].
    pub fn set_error_log_entries<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TransferErrorLogEntry>,
    {
        use std::iter::Iterator;
        self.error_log_entries = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for TransferErrorSummary {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.TransferErrorSummary"
    }
}

/// Metadata related to the data import operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportDataMetadata {
    /// Data transfer operation metadata.
    pub operation_metadata: std::option::Option<crate::model::TransferOperationMetadata>,

    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have [Operation.error][google.longrunning.Operation.error] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ImportDataMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [operation_metadata][crate::model::ImportDataMetadata::operation_metadata].
    pub fn set_operation_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TransferOperationMetadata>,
    {
        self.operation_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [operation_metadata][crate::model::ImportDataMetadata::operation_metadata].
    pub fn set_or_clear_operation_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TransferOperationMetadata>,
    {
        self.operation_metadata = v.map(|x| x.into());
        self
    }

    /// Sets the value of [create_time][crate::model::ImportDataMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ImportDataMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::ImportDataMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::ImportDataMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::ImportDataMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::ImportDataMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::ImportDataMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::ImportDataMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::ImportDataMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for ImportDataMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.ImportDataMetadata"
    }
}

/// The response to a request to export data from Parallelstore.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportDataResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportDataResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for ExportDataResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.ExportDataResponse"
    }
}

/// Metadata related to the data export operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportDataMetadata {
    /// Data transfer operation metadata.
    pub operation_metadata: std::option::Option<crate::model::TransferOperationMetadata>,

    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have [Operation.error][google.longrunning.Operation.error] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportDataMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [operation_metadata][crate::model::ExportDataMetadata::operation_metadata].
    pub fn set_operation_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TransferOperationMetadata>,
    {
        self.operation_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [operation_metadata][crate::model::ExportDataMetadata::operation_metadata].
    pub fn set_or_clear_operation_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TransferOperationMetadata>,
    {
        self.operation_metadata = v.map(|x| x.into());
        self
    }

    /// Sets the value of [create_time][crate::model::ExportDataMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ExportDataMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::ExportDataMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::ExportDataMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::ExportDataMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::ExportDataMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::ExportDataMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::ExportDataMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::ExportDataMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for ExportDataMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.ExportDataMetadata"
    }
}

/// Long-running operation metadata related to a data transfer.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransferOperationMetadata {
    /// Output only. The progress of the transfer operation.
    pub counters: std::option::Option<crate::model::TransferCounters>,

    /// Output only. The type of transfer occurring.
    pub transfer_type: crate::model::TransferType,

    /// Output only. List of files that failed to be transferred. This list will
    /// have a maximum size of 5 elements.
    pub error_summary: std::vec::Vec<crate::model::TransferErrorSummary>,

    /// The source of transfer operation.
    pub source: std::option::Option<crate::model::transfer_operation_metadata::Source>,

    /// The destination of transfer operation.
    pub destination: std::option::Option<crate::model::transfer_operation_metadata::Destination>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TransferOperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [counters][crate::model::TransferOperationMetadata::counters].
    pub fn set_counters<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TransferCounters>,
    {
        self.counters = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [counters][crate::model::TransferOperationMetadata::counters].
    pub fn set_or_clear_counters<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TransferCounters>,
    {
        self.counters = v.map(|x| x.into());
        self
    }

    /// Sets the value of [transfer_type][crate::model::TransferOperationMetadata::transfer_type].
    pub fn set_transfer_type<T: std::convert::Into<crate::model::TransferType>>(
        mut self,
        v: T,
    ) -> Self {
        self.transfer_type = v.into();
        self
    }

    /// Sets the value of [error_summary][crate::model::TransferOperationMetadata::error_summary].
    pub fn set_error_summary<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::TransferErrorSummary>,
    {
        use std::iter::Iterator;
        self.error_summary = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [source][crate::model::TransferOperationMetadata::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::transfer_operation_metadata::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::TransferOperationMetadata::source]
    /// if it holds a `SourceParallelstore`, `None` if the field is not set or
    /// holds a different branch.
    pub fn source_parallelstore(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::SourceParallelstore>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::transfer_operation_metadata::Source::SourceParallelstore(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::TransferOperationMetadata::source]
    /// to hold a `SourceParallelstore`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_source_parallelstore<
        T: std::convert::Into<std::boxed::Box<crate::model::SourceParallelstore>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::transfer_operation_metadata::Source::SourceParallelstore(v.into()),
        );
        self
    }

    /// The value of [source][crate::model::TransferOperationMetadata::source]
    /// if it holds a `SourceGcsBucket`, `None` if the field is not set or
    /// holds a different branch.
    pub fn source_gcs_bucket(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::SourceGcsBucket>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::transfer_operation_metadata::Source::SourceGcsBucket(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::TransferOperationMetadata::source]
    /// to hold a `SourceGcsBucket`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_source_gcs_bucket<
        T: std::convert::Into<std::boxed::Box<crate::model::SourceGcsBucket>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::transfer_operation_metadata::Source::SourceGcsBucket(v.into()),
        );
        self
    }

    /// Sets the value of [destination][crate::model::TransferOperationMetadata::destination].
    ///
    /// Note that all the setters affecting `destination` are mutually
    /// exclusive.
    pub fn set_destination<
        T: std::convert::Into<
                std::option::Option<crate::model::transfer_operation_metadata::Destination>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = v.into();
        self
    }

    /// The value of [destination][crate::model::TransferOperationMetadata::destination]
    /// if it holds a `DestinationGcsBucket`, `None` if the field is not set or
    /// holds a different branch.
    pub fn destination_gcs_bucket(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::DestinationGcsBucket>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::transfer_operation_metadata::Destination::DestinationGcsBucket(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::TransferOperationMetadata::destination]
    /// to hold a `DestinationGcsBucket`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_destination_gcs_bucket<
        T: std::convert::Into<std::boxed::Box<crate::model::DestinationGcsBucket>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::transfer_operation_metadata::Destination::DestinationGcsBucket(v.into()),
        );
        self
    }

    /// The value of [destination][crate::model::TransferOperationMetadata::destination]
    /// if it holds a `DestinationParallelstore`, `None` if the field is not set or
    /// holds a different branch.
    pub fn destination_parallelstore(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::DestinationParallelstore>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::transfer_operation_metadata::Destination::DestinationParallelstore(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::TransferOperationMetadata::destination]
    /// to hold a `DestinationParallelstore`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_destination_parallelstore<
        T: std::convert::Into<std::boxed::Box<crate::model::DestinationParallelstore>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::transfer_operation_metadata::Destination::DestinationParallelstore(
                v.into(),
            ),
        );
        self
    }
}

impl wkt::message::Message for TransferOperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.TransferOperationMetadata"
    }
}

/// Defines additional types related to [TransferOperationMetadata].
pub mod transfer_operation_metadata {
    #[allow(unused_imports)]
    use super::*;

    /// The source of transfer operation.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// Output only. Parallelstore source.
        SourceParallelstore(std::boxed::Box<crate::model::SourceParallelstore>),
        /// Output only. Cloud Storage source.
        SourceGcsBucket(std::boxed::Box<crate::model::SourceGcsBucket>),
    }

    /// The destination of transfer operation.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Destination {
        /// Output only. Cloud Storage destination.
        DestinationGcsBucket(std::boxed::Box<crate::model::DestinationGcsBucket>),
        /// Output only. Parallelstore destination.
        DestinationParallelstore(std::boxed::Box<crate::model::DestinationParallelstore>),
    }
}

/// A collection of counters that report the progress of a transfer operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransferCounters {
    /// Objects found in the data source that are scheduled to be transferred,
    /// excluding any that are filtered based on object conditions or skipped due
    /// to sync.
    pub objects_found: i64,

    /// Bytes found in the data source that are scheduled to be transferred,
    /// excluding any that are filtered based on object conditions or skipped due
    /// to sync.
    pub bytes_found: i64,

    /// Objects in the data source that are not transferred because they already
    /// exist in the data destination.
    pub objects_skipped: i64,

    /// Bytes in the data source that are not transferred because they already
    /// exist in the data destination.
    pub bytes_skipped: i64,

    /// Objects that are copied to the data destination.
    pub objects_copied: i64,

    /// Bytes that are copied to the data destination.
    pub bytes_copied: i64,

    /// Objects that failed to be written to the data destination.
    pub objects_failed: i64,

    /// Bytes that failed to be written to the data destination.
    pub bytes_failed: i64,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TransferCounters {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [objects_found][crate::model::TransferCounters::objects_found].
    pub fn set_objects_found<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.objects_found = v.into();
        self
    }

    /// Sets the value of [bytes_found][crate::model::TransferCounters::bytes_found].
    pub fn set_bytes_found<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.bytes_found = v.into();
        self
    }

    /// Sets the value of [objects_skipped][crate::model::TransferCounters::objects_skipped].
    pub fn set_objects_skipped<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.objects_skipped = v.into();
        self
    }

    /// Sets the value of [bytes_skipped][crate::model::TransferCounters::bytes_skipped].
    pub fn set_bytes_skipped<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.bytes_skipped = v.into();
        self
    }

    /// Sets the value of [objects_copied][crate::model::TransferCounters::objects_copied].
    pub fn set_objects_copied<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.objects_copied = v.into();
        self
    }

    /// Sets the value of [bytes_copied][crate::model::TransferCounters::bytes_copied].
    pub fn set_bytes_copied<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.bytes_copied = v.into();
        self
    }

    /// Sets the value of [objects_failed][crate::model::TransferCounters::objects_failed].
    pub fn set_objects_failed<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.objects_failed = v.into();
        self
    }

    /// Sets the value of [bytes_failed][crate::model::TransferCounters::bytes_failed].
    pub fn set_bytes_failed<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.bytes_failed = v.into();
        self
    }
}

impl wkt::message::Message for TransferCounters {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.parallelstore.v1.TransferCounters"
    }
}

/// Type of transfer that occurred.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TransferType {
    /// Zero is an illegal value.
    Unspecified,
    /// Imports to Parallelstore.
    Import,
    /// Exports from Parallelstore.
    Export,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [TransferType::value] or
    /// [TransferType::name].
    UnknownValue(transfer_type::UnknownValue),
}

#[doc(hidden)]
pub mod transfer_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl TransferType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Import => std::option::Option::Some(1),
            Self::Export => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("TRANSFER_TYPE_UNSPECIFIED"),
            Self::Import => std::option::Option::Some("IMPORT"),
            Self::Export => std::option::Option::Some("EXPORT"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for TransferType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for TransferType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for TransferType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Import,
            2 => Self::Export,
            _ => Self::UnknownValue(transfer_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for TransferType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "TRANSFER_TYPE_UNSPECIFIED" => Self::Unspecified,
            "IMPORT" => Self::Import,
            "EXPORT" => Self::Export,
            _ => Self::UnknownValue(transfer_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for TransferType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Import => serializer.serialize_i32(1),
            Self::Export => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for TransferType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransferType>::new(
            ".google.cloud.parallelstore.v1.TransferType",
        ))
    }
}

/// Represents the striping options for files.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FileStripeLevel {
    /// If not set, FileStripeLevel will default to FILE_STRIPE_LEVEL_BALANCED
    Unspecified,
    /// Minimum file striping
    Min,
    /// Medium file striping
    Balanced,
    /// Maximum file striping
    Max,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [FileStripeLevel::value] or
    /// [FileStripeLevel::name].
    UnknownValue(file_stripe_level::UnknownValue),
}

#[doc(hidden)]
pub mod file_stripe_level {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl FileStripeLevel {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Min => std::option::Option::Some(1),
            Self::Balanced => std::option::Option::Some(2),
            Self::Max => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("FILE_STRIPE_LEVEL_UNSPECIFIED"),
            Self::Min => std::option::Option::Some("FILE_STRIPE_LEVEL_MIN"),
            Self::Balanced => std::option::Option::Some("FILE_STRIPE_LEVEL_BALANCED"),
            Self::Max => std::option::Option::Some("FILE_STRIPE_LEVEL_MAX"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for FileStripeLevel {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for FileStripeLevel {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for FileStripeLevel {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Min,
            2 => Self::Balanced,
            3 => Self::Max,
            _ => Self::UnknownValue(file_stripe_level::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for FileStripeLevel {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "FILE_STRIPE_LEVEL_UNSPECIFIED" => Self::Unspecified,
            "FILE_STRIPE_LEVEL_MIN" => Self::Min,
            "FILE_STRIPE_LEVEL_BALANCED" => Self::Balanced,
            "FILE_STRIPE_LEVEL_MAX" => Self::Max,
            _ => Self::UnknownValue(file_stripe_level::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for FileStripeLevel {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Min => serializer.serialize_i32(1),
            Self::Balanced => serializer.serialize_i32(2),
            Self::Max => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for FileStripeLevel {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<FileStripeLevel>::new(
            ".google.cloud.parallelstore.v1.FileStripeLevel",
        ))
    }
}

/// Represents the striping options for directories.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DirectoryStripeLevel {
    /// If not set, DirectoryStripeLevel will default to DIRECTORY_STRIPE_LEVEL_MAX
    Unspecified,
    /// Minimum directory striping
    Min,
    /// Medium directory striping
    Balanced,
    /// Maximum directory striping
    Max,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [DirectoryStripeLevel::value] or
    /// [DirectoryStripeLevel::name].
    UnknownValue(directory_stripe_level::UnknownValue),
}

#[doc(hidden)]
pub mod directory_stripe_level {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl DirectoryStripeLevel {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Min => std::option::Option::Some(1),
            Self::Balanced => std::option::Option::Some(2),
            Self::Max => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("DIRECTORY_STRIPE_LEVEL_UNSPECIFIED"),
            Self::Min => std::option::Option::Some("DIRECTORY_STRIPE_LEVEL_MIN"),
            Self::Balanced => std::option::Option::Some("DIRECTORY_STRIPE_LEVEL_BALANCED"),
            Self::Max => std::option::Option::Some("DIRECTORY_STRIPE_LEVEL_MAX"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for DirectoryStripeLevel {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for DirectoryStripeLevel {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for DirectoryStripeLevel {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Min,
            2 => Self::Balanced,
            3 => Self::Max,
            _ => Self::UnknownValue(directory_stripe_level::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for DirectoryStripeLevel {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "DIRECTORY_STRIPE_LEVEL_UNSPECIFIED" => Self::Unspecified,
            "DIRECTORY_STRIPE_LEVEL_MIN" => Self::Min,
            "DIRECTORY_STRIPE_LEVEL_BALANCED" => Self::Balanced,
            "DIRECTORY_STRIPE_LEVEL_MAX" => Self::Max,
            _ => Self::UnknownValue(directory_stripe_level::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for DirectoryStripeLevel {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Min => serializer.serialize_i32(1),
            Self::Balanced => serializer.serialize_i32(2),
            Self::Max => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for DirectoryStripeLevel {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DirectoryStripeLevel>::new(
            ".google.cloud.parallelstore.v1.DirectoryStripeLevel",
        ))
    }
}

/// Represents the deployment type for the instance.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DeploymentType {
    /// Default Deployment Type
    /// It is equivalent to SCRATCH
    Unspecified,
    /// Scratch
    Scratch,
    /// Persistent
    Persistent,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [DeploymentType::value] or
    /// [DeploymentType::name].
    UnknownValue(deployment_type::UnknownValue),
}

#[doc(hidden)]
pub mod deployment_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl DeploymentType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Scratch => std::option::Option::Some(1),
            Self::Persistent => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("DEPLOYMENT_TYPE_UNSPECIFIED"),
            Self::Scratch => std::option::Option::Some("SCRATCH"),
            Self::Persistent => std::option::Option::Some("PERSISTENT"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for DeploymentType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for DeploymentType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for DeploymentType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Scratch,
            2 => Self::Persistent,
            _ => Self::UnknownValue(deployment_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for DeploymentType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "DEPLOYMENT_TYPE_UNSPECIFIED" => Self::Unspecified,
            "SCRATCH" => Self::Scratch,
            "PERSISTENT" => Self::Persistent,
            _ => Self::UnknownValue(deployment_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for DeploymentType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Scratch => serializer.serialize_i32(1),
            Self::Persistent => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for DeploymentType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DeploymentType>::new(
            ".google.cloud.parallelstore.v1.DeploymentType",
        ))
    }
}
